home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectMusic / PlayMotif / readme.txt < prev    next >
Encoding:
Text File  |  2001-10-10  |  4.1 KB  |  86 lines

  1. //-----------------------------------------------------------------------------
  2. // 
  3. // Sample Name: VB PlayMotif Sample
  4. // 
  5. // Copyright (C) 1999-2001 Microsoft Corporation. All rights reserved.
  6. //
  7. // GM/GS« Sound Set Copyright ⌐1996, Roland Corporation U.S.
  8. // 
  9. //-----------------------------------------------------------------------------
  10.  
  11.  
  12.  
  13. Description
  14. ===========
  15.   The PlayMotif sample demonstrates how a motif played as a secondary 
  16.   segment can be aligned to the rhythm of the primary segment in various ways.
  17.  
  18. Path
  19. ====
  20.   Source: DXSDK\Samples\Multimedia\VBSamples\DirectMusic\PlayMotif
  21.  
  22.   Executable: DXSDK\Samples\Multimedia\VBSamples\DirectMusic\Bin
  23.  
  24. User's Guide
  25. ============
  26.   Play the default segment, or load another DirectMusic Producer segment 
  27.   that contains motifs. Select one of the patterns in the list box and 
  28.   one of the Align Option buttons, and then click Play Motif. Note how 
  29.   the motif does not begin playing until an appropriate boundary in the 
  30.   primary segment has been reached.
  31.  
  32. Programming Notes
  33. =================
  34.   The PlayMotif sample is very similar in form to the PlayAudio sample.  For 
  35.   detailed programming notes on the basics this sample, refer to Programming 
  36.   Notes section of the PlayAudio sample.
  37.   
  38.   The PlayMotif differs by letting the user play any of motifs contained 
  39.   inside the segment. Here's how:
  40.   
  41.   * When loading the file it does the same steps as the PlayAudio 
  42.     sample, but also:  
  43.         1. It loops thru each style in the segment, searching it for 
  44.            motifs.  It calls DirectMusicSegment8.GetStyle passing 
  45.            an increasing style index to get each of the styles.  When 
  46.            this returns error then there are no more styles.
  47.         2. For each style, it calls DirectMusicStyle.GetMotifCount.
  48.            It then loops through each Motif, and stores the motif name 
  49.            in the list box.
  50.         3. With the motif name it calls DirectMusicStyle::GetMotif
  51.            to get a DirectMusicSegment pointer to the motif, and
  52.            stores this for later use.
  53.            
  54.    * When "Play Motif" is clicked.  See cmdPlayMotif_Click().
  55.         1. It gets the desired alignment option from the UI.  
  56.         2. It gets the selected motif from our interal list.
  57.         3. It calls DirectMusicPerformance::PlaySegmentEx passing in
  58.            the motif's DirectMusicSegment and flags which have 
  59.            DMUS_SEGF_SECONDARY as well as any alignment option.
  60.        
  61.    * When DirectMusic notifications occur, it is similar to PlayAudio but 
  62.      now the app also takes note of any motif starting or stopping and
  63.      updates the play count.  If the play count is greater than zero then
  64.      it updates the UI to show that the motif is playing.  Most games
  65.      would not need this functionality, but here's how its done: 
  66.      See DirectXEvent8_DXCallback.
  67.         - Call DirectMusicPerformance8::GetNotificationPMsg.
  68.         - Check if the pPMsg->lNotificationOption. 
  69.         - If it is a DMUS_NOTIFICATION_SEGSTART.  This tells 
  70.           us that a segment has ended.  It may be for a motif or the primary
  71.           or some embedded segment in the primary segment.  
  72.         - If it is a DMUS_NOTIFICATION_SEGEND.  This tells 
  73.           us that a segment has ended.  It may be for a motif or the primary
  74.           or some embedded segment in the primary segment.  
  75.         - For either SEGSTART or SEGEND the code is similar:
  76.             1. Get a DirectMusicSegmentState8 from pPMsg.User.
  77.             2. Using the IDirectMusicSegmentState8, call GetSegment to 
  78.                get a DirectMusicSegment of the segment it refers to.  
  79.                This call may fail is the segment may have gone away before this
  80.                notification was handled.
  81.             4. Compare this segment to the primary segment to see if this was 
  82.                the primary segment.  If it was, then update the UI. If its not 
  83.                then compare it to each of the motif's segments.  If a match is 
  84.                found update the UI accordingly.
  85.             5. Cleanup all the interfaces.
  86.